//
// Created by lyx on 2020/8/6.
//
#include <iostream>
#include <vector>
#include <Utils.h>
using namespace std;
namespace np=lyxutils::numpy;
namespace xio=lyxutils::io;
using Vector3f=lyxutils::Vector3<float>;

int main(){
    vector<float> a;
    np::range<float>(a,0,10,1);
    cout<<"a=range(0,10,1)="<<endl;
    np::print(a);
    vector<double> b;
    np::linspace<double>(b,7,-1,9);
    cout<<"b=linspace(7,-1,9)="<<endl;
    np::print(b);
    vector<int> c;
    np::broadcast(5,8,c);
    cout<<"broadcast 5 into 8-element list of 5:"<<endl;
    np::print(c);
    vector<vector<float> > d;
    np::broadcast(a,5,d);
    cout<<"broadcast a into 5x10 matrix:"<<endl;
    np::print(d);
    vector<vector<double> > e;
    np::reshape(b,3,3,e);
    cout<<"reshape b into e(3x3 matrix):"<<endl;
    np::print(e);
    vector<vector<double> > f;
    np::transpose(e,f);
    cout<<"traspose e into f:"<<endl;
    np::print(f);
    vector<double> g;
    np::flat(f,g);
    cout<<"flat f into g:"<<endl;
    np::print(g);
    vector<vector<double> > h;
    np::add(e,f,h);
    cout<<"h=e+f="<<endl;
    np::print(h);
    vector<Vector3f> i={{1,3,4},{5,2,6},{9,0,7}};
    vector<Vector3f> j={{1},{4,2,8},{3,5,6}};
    cout<<"print vector of Vector3f i,j:"<<endl;
    np::print(i);
    np::print(j);
    vector<Vector3f> k;
    np::add(i,j,k);
    cout<<"k=i+j="<<endl;
    np::print(k);
    auto l=np::sum(i);
    cout<<"l=sum(i)="<<l<<endl;
    auto m=np::mean(i);
    cout<<"m=mean(i)="<<m<<endl;
    vector<vector<float> > pts={{2,3,4},{3,4,5},{4,5,6},{6,7,8},{5,6,7}};
    vector<vector<float> > covariance;
    np::cov(pts,covariance);
    cout<<"covariance="<<endl;
    np::print(covariance);
    vector<double> n={1,2,3,4};
    vector<double> o={6,5,8,7};
    cout<<"n=";
    np::print(n);
    cout<<"o=";
    np::print(o);
    double p=np::multiply(n,o);
    cout<<"n*o="<<p<<endl;
    vector<Vector3f> q={{1,1,1},{2,3,4},{7,4,9}};
    vector<Vector3f> r={{2,3,1},{4,5,7},{3,6,8}};
    cout<<"q="<<endl;
    np::print(q);
    cout<<"r="<<endl;
    np::print(r);
    Vector3f res=np::multiply(q,r);
    cout<<"q*r="<<res<<endl;
    cout<<"s="<<endl;
    vector<vector<float> > s={{1,2,1},{2,3,4}};
    vector<vector<float> > t={{2,3},{4,5},{1,7}};
    np::print(s);
    cout<<"t="<<endl;
    np::print(t);
    cout<<"s@t="<<endl;
    vector<vector<float> > crossST;
    np::multiply(s,t,crossST);
    np::print(crossST);
}